﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using com.cgWorkstudio.BIMP.Library.vo;
using com.cgWorkstudio.BIMP.Library.Properties;

namespace com.cgWorkstudio.BIMP.Library.uc {
    public partial class UC_TopButton:UserControl {
        CGTopButtonType _topButtonType = CGTopButtonType.会员管理;
        [Description("顶部按钮类型")]
        public CGTopButtonType TopButtonType {
            get {
                return _topButtonType;
            }
            set {
                _topButtonType = value;
                setDefaultPic();
            }
        }
        public UC_TopButton() {
            InitializeComponent();
            this.MouseMove += new MouseEventHandler(UC_TopButton_MouseMove);
            this.MouseLeave += new EventHandler(UC_TopButton_MouseLeave);
        }
        bool mouseMoving = false;
        void UC_TopButton_MouseLeave(object sender,EventArgs e) {
            mouseMoving = false;
            setDefaultPic();
        }

        void UC_TopButton_MouseMove(object sender,MouseEventArgs e) {
            if(mouseMoving == true) {
                return;
            }
            mouseMoving = true;
            setMouseMovePic();
        }

        private void setMouseMovePic() {
            switch(TopButtonType) {
                case CGTopButtonType.会员管理:
                    this.BackgroundImage = Resources.TopButton_会员管理_Hover;
                    break;
                case CGTopButtonType.商品管理:
                    this.BackgroundImage = Resources.TopButton_商品管理_Hover;
                    break;
                case CGTopButtonType.统计管理:
                    this.BackgroundImage = Resources.TopButton_统计管理_Hover;
                    break;
                case CGTopButtonType.系统管理:
                    this.BackgroundImage = Resources.TopButton_系统管理_Hover;
                    break;
                case CGTopButtonType.项目管理:
                    this.BackgroundImage = Resources.TopButton_项目管理_Hover;
                    break;
                case CGTopButtonType.员工管理:
                    this.BackgroundImage = Resources.TopButton_员工管理_Hover;
                    break;
                case CGTopButtonType.重新登录:
                    this.BackgroundImage = Resources.TopButton_重新登录_Hover;
                    break;
            }
        }
        void setDefaultPic() {
            switch(TopButtonType) {
                case CGTopButtonType.会员管理:
                    this.BackgroundImage = Resources.TopButton_会员管理_Default;
                    break;
                case CGTopButtonType.商品管理:
                    this.BackgroundImage = Resources.TopButton_商品管理_Default;
                    break;
                case CGTopButtonType.统计管理:
                    this.BackgroundImage = Resources.TopButton_统计管理_Default;
                    break;
                case CGTopButtonType.系统管理:
                    this.BackgroundImage = Resources.TopButton_系统管理_Default;
                    break;
                case CGTopButtonType.项目管理:
                    this.BackgroundImage = Resources.TopButton_项目管理_Default;
                    break;
                case CGTopButtonType.员工管理:
                    this.BackgroundImage = Resources.TopButton_员工管理_Default;
                    break;
                case CGTopButtonType.重新登录:
                    this.BackgroundImage = Resources.TopButton_重新登录_Default;
                    break;
            }
        }
    }
}
